package com.xn.coursed.controller;

import com.xn.coursed.service.MapService;
import com.xn.coursed.pojo.dto.MapDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@Slf4j
public class MapController {

    @Autowired
    private MapService mapService;

    @PostMapping("/getDistance")
    public Map<String, String> getDistance(@RequestBody MapDTO mapDTO){
        log.info("接收到前端参数 开始生成最短路径");
        Map<String, String> response =mapService.getDistance(mapDTO);
        return response;
    }
    @PostMapping("/getMinTree")
    public Map<String, String> getMinTree(@RequestBody MapDTO mapDTO){
        log.info("接收到前端参数 开始生成最短路径");
        Map<String, String> response =mapService.getDistance(mapDTO);
        return response;
    }
//    @PostMapping("/getMinTree")
//    public Map<String ,String>minTree(@RequestBody MapDTO mapDTO){
//        log.info("接受到前端参数 开始生成最小生成树");
//        Map<String ,String> response=mapService.minTree(mapDTO);
//        return response;
//    }
}
